<template>
  <div class="box">
    <!-- <Scroll ref="scroll" class="content" :h='100'> -->
    <div class="slide">
      <div class="slide-icon" @click="showPopup">
        <span class="iconfont icon-liebiao"></span>
      </div>
    </div>
    <van-popup
      v-model="show"
      position="left"
      class="menusPopup"
      :style="{ width: '80%' }"
    >
      <slideNav></slideNav>
    </van-popup>
    <div class="fix" v-show="isshow">
      <div class="fix_silde iconfont icon-liebiao"></div>
      <div class="fix_photo">
        <span><img :src="userInfo.profile.avatarUrl" /></span>
        <div class="fix_name">{{ userInfo.profile.nickname }}</div>
      </div>
    </div>
    <Scroll ref="scroll" class="content" :h="50">
      <div class="main">
        <div class="user-name">
          <div class="head">
            <span>
              <img :src="userInfo.profile.avatarUrl" />
            </span>
          </div>
          <div class="name">
            <span>{{ userInfo.profile.nickname }}</span>
          </div>
          <div class="icon">
            <router-link
              class="iconfont icon-dibudaohanglan-"
              :to="{ name: 'userinfo' }"
            ></router-link>
          </div>
        </div>
        <div class="music">
          <div class="music-wrap"></div>
          <router-link class="icon" :to="{ name: 'latest' }">
            <span class="iconfont icon-iconset0481"></span>
            <em>最近播放</em>
          </router-link>
          <div class="icon">
            <span class="iconfont icon-caidan"></span>
            <em>本地音乐</em>
          </div>
          <div class="icon">
            <span class="iconfont icon-wode1"></span>
            <em>本地音乐</em>
          </div>
          <div class="icon">
            <span class="iconfont icon-guanzhu"></span>
            <em>本地音乐</em>
          </div>
          <div class="icon">
            <span class="iconfont icon-xingxing"></span>
            <em>本地音乐</em>
          </div>
          <div class="icon">
            <span class="iconfont icon-faxian"></span>
            <em>本地音乐</em>
          </div>
          <div class="icon">
            <span class="iconfont icon-yinlemusic215"></span>
            <em>本地音乐</em>
          </div>
          <div class="icon">
            <span class="iconfont icon-jiahao" style="color: #ccc;"></span>
            <em>本地音乐</em>
          </div>
        </div>
        <div class="like">
          <div class="photo">
            <!-- <img :src="singList[0].coverImgUrl"> -->
          </div>
          <div class="dra">
            <span>我喜欢的音乐</span>
            <!-- <i>{{ singList[0].trackCount }}首</i> -->
          </div>
          <div class="pattern">
            <span class="iconfont icon-xin"><em>心动模式</em></span>
          </div>
        </div>
        <div class="list">
          <van-tabs animated>
            <van-tab title="收藏歌单">
              <div class="list-wrap">
                <div class="create-list">
                  <span>收藏歌单</span>
                  <span class="iconfont icon-jiahao"></span>
                </div>
                <div
                  class="sing-list"
                  v-for="(item, index) in singList"
                  @click="goDetail(item.id)"
                >
                  <div class="photo">
                    <img :src="item.coverImgUrl" />
                  </div>
                  <div class="dra">
                    <span>{{ item.name }}</span>
                    <i
                      >{{ item.trackCount }}首, by{{ item.creator.nickname }}</i
                    >
                  </div>
                  <!-- <div class="pattern">
                  <span class="iconfont icon-xin"><em>心动模式</em></span>
                </div> -->
                </div>
              </div>
            </van-tab>
            <van-tab title="创建歌单">
              <div class="list-wrap">
                <div class="create-list">
                  <span>创建歌单</span>
                  <span class="iconfont icon-jiahao"></span>
                </div>
                <div class="sing-list">
                  <div class="photo"></div>
                  <div class="dra">
                    <span>我喜欢的音乐</span>
                    <i>361首</i>
                  </div>
                  <!-- <div class="pattern">
                  <span class="iconfont icon-xin"><em>心动模式</em></span>
                </div> -->
                </div>
              </div>
            </van-tab>
          </van-tabs>
        </div>
      </div>
    </Scroll>
    <!-- </Scroll> -->
  </div>
</template>

<script>
import "../../assets/iconfont/iconfont.css";
import Vue from "vue";
import { Tab, Tabs, Popup, Dialog } from "vant";
import { mapGetters, mapState } from "vuex";
import Scroll from "@/components/global/scroll";
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(Popup);
Vue.use(Dialog);
export default {
  data() {
    return {
      show: false,
      isshow: false,
      // uid:userInfo.account.id
    };
  },
  components: {
    // [Popup.name]: Popup,
    Scroll,
  },
  computed: {
    ...mapGetters(["userInfo", "singList"]),
    // ...mapState({
    //       userInfo:state=>state.userInfo.all
    //     })
  },
  beforeCreate() {
    let id =
      this.$store.getters.getId || this.$store.getters.userInfo.account.id;
    // console.log(this.$store.getters.getId);
    this.$store.dispatch("getSingList", id);
  },
  created() {},
  change() {},
  mounted() {
    window.addEventListener("scroll", (e) => {
      if (document.documentElement.scrollTop > 100) {
        this.isshow = true;
      } else {
        this.isshow = false;
      }
    });
  },
  methods: {
    showPopup() {
      this.show = true;
    },
    goDetail(id) {
      this.$store.dispatch("getSingListDetail", id);
      this.$router.push("/singListDetail");
    },
  },
};
</script>

<style lang="scss" scoped>
.box {
  background: #f0eff1;
  .fix {
    width: 100%;
    height: 50px;
    background: #fff;
    position: fixed;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    .fix_silde {
      width: 35%;
      font-size: 28px;
      font-weight: 400;
      color: #333;
    }
    .fix_photo {
      width: 65%;
      display: flex;
      line-height: 20px;
      span {
        display: block;
        width: 25px;
        height: 25px;
        border-radius: 50%;
        background: forestgreen;
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .fix_name {
        color: #333;
        margin-left: 10px;
        line-height: 28px;
      }
    }
  }
  .slide {
    box-sizing: border-box;
    // padding: 0 10px;
    background: #f0eff1;
    width: 100%;
    // height: 50px;
    line-height: 40px;
    span {
      display: block;
      // margin-top: 5px;
      font-size: 30px;
      // text-align: center;
      line-height: 40px;
    }
  }
  .menusPopup {
    background: #fff;
    width: 50%;
    .title {
      height: 675px;
      width: 20px;
    }
  }
  .main {
    box-sizing: border-box;
    width: 100%;
    background: #f0eff1;
    padding: 0 10px;
    padding-bottom: 100px;

    .user-name {
      display: flex;
      width: 100%;
      box-sizing: border-box;
      padding: 10px 10px;
      .head {
        width: 20%;
        span {
          display: block;
          width: 50px;
          height: 50px;
          border: 3px solid #fff;
          border-radius: 50%;
          background: yellowgreen;
          overflow: hidden;
          img {
            width: 100%;
            height: 100%;
          }
        }
      }
      .name {
        width: 60%;
        span {
          display: block;
          margin-top: 10px;
          font-size: 18px;
          font-weight: 700;
        }
      }
      .icon {
        width: 15%;
        text-align: center;
        font-size: 18px;
        .iconfont {
          color: #333;
          font-weight: 600;
          display: table-cell;
          vertical-align: center;
          position: relative;
          top: 13px;
          left: 40px;
        }
        span {
          // vertical-align: center;
          // display: table-cell;
          display: block;
          font-size: 20px !important;
          margin-top: 18px;
        }
        em {
          // font-size: 14px;
          display: block;
          margin-top: 3px;
        }
      }
    }
    .music {
      width: 100%;
      height: 150px;
      background: #fff;
      border-radius: 15px;
      display: flex;
      justify-content: space-around;
      flex-wrap: wrap;
      align-items: center;
      text-align: center;
      .icon {
        width: 25%;
        display: flex;
        flex-direction: column;
        span {
          font-size: 22px;
          font-weight: 400;
          color: #ff3a3a;
        }
        em {
          display: block;
          margin-top: 3px;
          font-style: inherit;
          font-family: inherit;
          color: #666;
        }
      }
    }
    .like {
      height: 75px;
      background: #fff;
      margin-top: 20px;
      border-radius: 15px;
      display: flex;
      justify-content: space-around;
      text-align: center;
      align-items: center;
      .photo {
        margin: 0 10px;
        width: 50px;
        height: 50px;
        border-radius: 15px;
        background: khaki;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .dra {
        // width: 50%;
        display: flex;
        flex-direction: column;
        span {
          text-align: left;
          font-size: 14px;
          color: #333;
        //   width: 280px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
        i {
          font-style: inherit;
          text-align: left;
          font-size: 12px;
          color: #999;
          font-size: 10px;
        }
      }
      .pattern {
        text-align: center;
        padding: 5px;
        width: 80px;
        height: 20px;
        border: 1px solid #e6e6e6;
        border-radius: 15px;
        span,
        .iconfont {
          font-size: 12px;
          color: #333;
          em {
            margin-left: 3px;
            font-style: inherit;
          }
        }
      }
    }
    .list {
      margin-top: 10px;
      /deep/.van-tabs__nav {
        background-color: #f0eff1 !important;
        /deep/.van-tabs__line {
          width: 58px;
          bottom: 28px;
          height: 4px;
          // top: ;
        }
      }
      .list-wrap {
        width: 100%;
        // height: 300px;
        background: #fff;
        border-radius: 15px;
        margin-top: 10px;
        padding: 0 20px;
        padding-bottom: 50px;
        box-sizing: border-box;
        .create-list {
          height: 40px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          span {
            color: #999;
          }
        }
        .sing-list {
          height: 60px;
          background: #fff;
          // margin-top: 20px;
          border-radius: 15px;
          display: flex;
          text-align: center;
          align-items: center;
          .photo {
            margin-right: 10px;
            width: 50px;
            height: 50px;
            border-radius: 15px;
            background: khaki;
            font-size: 10px;
            img {
              width: 100%;
              height: 100%;
            }
          }
          .dra {
            width: 50%;
            display: flex;
            flex-direction: column;

            span {
              width: 240px;
              text-align: left;
              // font-size: 16px;
              color: #333;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
            i {
              font-style: inherit;
              text-align: left;
              font-size: 12px;
              color: #999;
            }
          }
          // .pattern {
          //   text-align: center;
          //   padding: 5px;
          //   width: 80px;
          //   height: 20px;
          //   border: 1px solid #e6e6e6;
          //   border-radius: 15px;
          //   span,
          //   .iconfont {
          //     font-size: 12px;
          //     color: #333;
          //     em {
          //       margin-left: 3px;
          //       font-style: inherit;
          //     }
          //   }
          // }
        }
      }
    }
  }
}
</style>
